<%@ page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>单个随访组</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/common/layui/css/layui.css"
          media="all">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/common/bootstrap/css/bootstrap.css"
          media="all">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/common/global.css">
    <%--日期控件--%>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/common/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/common/bootstrap/js/jquery-1.12.4.js"></script>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/common/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/jsplug/echarts.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/common/layui/layui.js"></script>
</head>
<body>
<div style="font-size: 18px; margin-right: 10px; float: right;background-color: #00acd6; border-radius: 30px; text-align: center;">
    <a href="${pageContext.request.contextPath}/group/list" style="color: black;"><i class="glyphicon glyphicon-share-alt"></i>返回</a>
</div>
<div class="container">
    <div class="panel-body">
        <form action="" id="formGrouptable" method="post" class="form-horizontal">
            <div class="col-sm-12">
                <div class="form-group col-sm-1">
                    <label for="outpatientServiceNo" class="control-label">门诊号:
                    </label>
                </div>
                <div class=" col-sm-2">
                    <input type="text" class="form-control" id="outpatientServiceNo" name="outpatientServiceNo" >
                </div>
                <div class="form-group col-sm-1">
                    <label for="hospitalNumber" class="control-label">住院号:
                    </label>
                </div>
                <div class=" col-sm-2">
                    <input type="text" class="form-control" id="hospitalNumber" name="hospitalNumber" >
                </div>

                    <div class="form-group col-sm-1">
                        <label for="kaishi" class="control-label">入组日期:
                        </label>
                    </div>
                    <div class="col-sm-2">
                        <input  class="form-control" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'jieshu\')}'});" id="kaishi" name="kaishi" >
                    </div>
                    <div class="form-group col-sm-1">
                        <label for="jieshu" class="control-label">——</label>
                    </div>
                    <div class="col-sm-2">
                        <input onclick="WdatePicker({minDate:'#F{$dp.$D(\'kaishi\')}'});" class="form-control" id="jieshu" name="jieshu">
                    </div>
            </div>
            <div class="col-sm-12">
                <div class="form-group col-sm-1">
                    <label for="gender" class="control-label">性别:
                    </label>
                </div>
                <div class="col-sm-2">
                    <select class="form-control" id="gender" name="gender">
                        <option value="">请选择</option>
                        <option value="1">男</option>
                        <option value="2">女</option>
                        <option value="3">其他</option>
                    </select>
                </div>
                <div class="form-group col-sm-1">
                    <label for="patientName" class="control-label">姓名:
                    </label>
                </div>
                <div class="col-sm-2">
                    <input type="text" class="form-control" id="patientName" name="patientName" value="">
                </div>
                <div class="form-group col-sm-1 ">
                    <button id="selectGrouptable" type="button"  class="btn btn-primary btn-block">检索</button>
                </div>
            </div>
        </form>
        <ul id="myTab" class="col-sm-12 nav nav-tabs">
            <li class="col-sm-4 nav1 active" id="application_information">
                <a href="#home" data-toggle="tab">
                    <span class="nav2">1</span>组内病人
                </a>
            </li>
            <li class="col-sm-4 nav1" id="query_conditions">
                <a href="#ios" data-toggle="tab">
                    <span class="nav2">2</span>组内随访员
                </a>
            </li>
        </ul>
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade in active" id="home">
                <div class="col-sm-12" style="height: 50px; line-height: 50px; font-size: 16px;">
                    <div class="col-sm-2">
                        <a href='${pageContext.request.contextPath}/foGroup/addFogroupPatientInformationSheet?foGroupId=${foGroup.foGroupId}'
                           style="color:blue;">新增病人</a>
                    </div>
                    <div class=" col-sm-1">
                        <a id="shanchu" style="color:blue" href="#">删除</a>
                    </div>
                </div>
                <div class="col-sm-12">
                    <table class="table table-bordered">
                        <thead>
                        <tr>
                            <th></th>
                            <th>门诊号/住院号</th>
                            <th>姓名</th>
                            <th>性别</th>
                            <th>年龄</th>
                            <th>入组日期</th>
                            <th>查看</th>
                        </tr>
                        </thead>
                        <tbody id="xiala">
                        <c:forEach var="foGrouplist" items="${foGroupList}">
                            <tr>
                                <td>
                                    <div class="checkbox">
                                        <label><input type="checkbox" name="patientId"
                                                      value="${foGrouplist.patientInformationSheet.patientId}"></label>
                                    </div>
                                </td>
                                <td>${foGrouplist.patientInformationSheet.diagnosises.outpatientServiceNo}
                                    /${foGrouplist.patientInformationSheet.diagnosises.hospitalNumber}
                                </td>
                                <td>${foGrouplist.patientInformationSheet.patientName}</td>
                                <td><c:if test="${foGrouplist.patientInformationSheet.gender ==1}">
                                    男
                                </c:if>
                                    <c:if test="${foGrouplist.patientInformationSheet.gender ==2}">
                                        女
                                    </c:if>
                                </td>
                                <td>${foGrouplist.patientInformationSheet.age}</td>
                                <td><fmt:formatDate pattern="yyyy-MM-dd" value="${foGrouplist.dateOfEntry}"/></td>
                                <td align="center">
                                    <a href='${pageContext.request.contextPath}/patientSignsAnemia/patientSignsAnemiaFoDiagnosis?patientId=${foGrouplist.patientInformationSheet.patientId}'>
                                        <button id="chakanhuanzhe" class="btn" style=" background-color:transparent;">
                                            <i style="color: black;" class="glyphicon glyphicon-search"></i></button>
                                    </a>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="tab-pane fade" id="ios">
                <div class="col-sm-12" style="height: 50px; line-height: 50px; font-size: 16px;">
                    <div class=" col-sm-2">
                        <a href='${pageContext.request.contextPath}/foGroup/addFogroupMeaningUser?foGroupId=${foGroup.foGroupId}'
                           style="color: blue">新增随访员</a>
                    </div>
                    <div class=" col-sm-1">
                        <a id="shanchu2" style="color: blue" href="#">删除</a>
                    </div>
                </div>
                <div class="col-sm-12">
                    <table class="table table-bordered">
                        <thead>
                        <tr>
                            <th></th>
                            <th>姓名</th>
                            <th>性别</th>
                            <th>年龄</th>
                            <th>入组日期</th>
                            <th>所属科室</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="fo2Grouplist" items="${fo2GroupIdList}">
                            <tr>
                                <td>
                                    <div class="checkbox">
                                        <label><input type="checkbox" name="userId"
                                                      value="${fo2Grouplist.meaningUser.userId}"></label>
                                    </div>
                                </td>
                                <td>${fo2Grouplist.meaningUser.username}</td>
                                <td><c:if test="${fo2Grouplist.meaningUser.userSex ==1}">
                                    男
                                </c:if>
                                    <c:if test="${fo2Grouplist.meaningUser.userSex ==2}">
                                        女
                                    </c:if>
                                </td>
                                <td>${fo2Grouplist.meaningUser.userAge}</td>
                                <td><fmt:formatDate pattern="yyyy-MM-dd" value="${fo2Grouplist.thesetDate}"/></td>
                                <td>${fo2Grouplist.meaningUser.departmentName}</td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
        $(function () {
            //检索
            $("#selectGrouptable").click(function () {
                    $("#formGrouptable").attr("action", "list?foGroupId=" + '${foGroup.foGroupId}');
                    $("#formGrouptable").submit();
            });
            //删除
            $("#shanchu2").click(function () {
                var id_array = [];
                $("input[name='userId']:checked").each(function (i) {
                    id_array.push($(this).val())
                });
                $.ajax({
                    url: "${pageContext.request.contextPath}/foGroup/deletefo2GroupId",
                    type: "post",
                    data: "userId=" + id_array,
                    dataType: "JSON",
                    success: function (data) {
                        if (data > 0) {
                            alert("删除成功！");
                            window.location.reload()
                        }
                    }
                });
            });
            //删除
            $("#shanchu").click(function () {
                var id_array = [];
                $("input[name='patientId']:checked").each(function (i) {
                    id_array.push($(this).val())
                });
                $.ajax({
                    url: "${pageContext.request.contextPath}/foGroup/deletefoGroupId",
                    type:"post",
                    data: "patientId=" + id_array,
                    dataType:"JSON",
                    success:function(data){
                        if(data>0){
                            alert("删除成功！");
                            window.location.reload();
                        }
                    }
                });
            });
})
</script>
</html>